import React, { memo, useEffect, useState } from 'react'

export default memo(function App() {
  const [counter, setCounter] = useState(200)
  const [message, setMessage] = useState('hello world')

  useEffect(() => {
    console.log('修改title', counter)
  }, [counter])

  useEffect(() => {
    console.log('监听redux监听')
    return () => {
      // console.log('取消监听redux监听')
    }
  }, [message])

  useEffect(() => {
    console.log('eventBus监听')
    return () => {
      // console.log('eventBus取消监听')
    }
  }, [])

  useEffect(() => {
    console.log('发送网络请求')
  }, [])

  return (
    <div>
      <h1>{counter}</h1>
      <button onClick={(e) => setCounter(counter + 1)}>+1</button>
      <button onClick={(e) => setMessage('hello 123')}>修改message</button>
    </div>
  )
})
